Skip to main content

Face Class

Description:

  A record provides functions of creating instances of the Face component with different configurations.

Usage:

local Face = require("Face")
local faceA = Face("Image/file.png")
local faceB = Face(function()
return Sprite("Image/file.png")
end)
faceA:toNode():addTo(entry)
faceB:toNode():addTo(entry)

__call

Type: Metamethod.

Description:

  Creates a new Face definition using the specified attributes.

Signature:

metamethod __call: function(
self: FaceClass,
faceStr: string,
point?: Vec2 --[[Vec2.zero]],
scale?: number --[[1.0]],
angle?: number --[[0.0]]
): Face

Parameters:

ParameterTypeDescription
faceStrstringA string for creating the Face component.Could be 'Image/file.png' and 'Image/items.clip
pointVec2[optional] The position of the Face component, default is Vec2.zero.
scalenumber[optional] The scale of the Face component, default is 1.0.
anglenumber[optional] The angle of the Face component, default is 0.0.

Returns:

Return TypeDescription
FaceThe new Face component.

__call

Type: Metamethod.

Description:

  Creates a new Face definition using the specified attributes.

Signature:

metamethod __call: function(
self: FaceClass,
createFunc: function(): (Node),
point?: Vec2 --[[Vec2.zero]],
scale?: number --[[1.0]],
angle?: number --[[0.0]]
): Face

Parameters:

ParameterTypeDescription
createFuncfunctionA function that returns a Node representing the Face component.
pointVec2[optional] The position of the Face component, default is Vec2.zero.
scalenumber[optional] The scale of the Face component, default is 1.0.
anglenumber[optional] The angle of the Face component, default is 0.0.

Returns:

Return TypeDescription
FaceThe new Face component.